package helper

import (
	"github.com/wenzhenxi/gorsa"
)

var PublicKey = `-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl5310BTgSFfrAc8s/tdE
jDiiYE9kl4Fves/d1SvwMWFn+yxl0sguZ3RTBVkrpf+sFIeV3EJ8grvmpBy7IId6
o5wtAsSpAjC42xmq2vAWdcCjjJZRqbg9VSmmNYQIMCylGu4ZyL72BqabnGaDHCsO
dYbYczDsq86HWjF3Sjl7huk/ZSuwG806H8tl/CMhwIQhKSu9wJpRW94bQzLVFdHL
A1/3JzAkm0/46o99AfAH56Kh0sUcAVDEQDbs+dkczC9dnKGjYXTlDd0FAZHQ6AQ8
+tTvYpg1eiiaU8CmWCHa0DSMos2o/Gsqw+0ut60UBNIoloYRBazI09nDGuq7D0Kc
7QIDAQAB
-----END PUBLIC KEY-----`

/**
  get decrypted license by license encrypted
*/
func PublicKeyDecrypt(prienctypt string) (string, error) {
	pubdecrypt, err := gorsa.PublicDecrypt(prienctypt, PublicKey)
	if err != nil {
		return "", err
	}
	//log.Println(pubdecrypt)
	return pubdecrypt, nil
}
